<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>{$title}</title>
	<meta name="keywords" content="{$keyword}" />
	<meta name="description" content="{$description}" />
	<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico">
	<link rel="stylesheet" href="__INDEX__/style/base.css" type="text/css">
	<link rel="stylesheet" href="__INDEX__/style/global.css" type="text/css">
	<link rel="stylesheet" href="__INDEX__/style/header.css" type="text/css">
	{volist name="style" id="css"}
	<link rel="stylesheet" href="__INDEX__/style/{$css}.css" type="text/css">
	{/volist}
	<link rel="stylesheet" href="__INDEX__/style/footer.css" type="text/css">
	<script type="text/javascript" src="__INDEX__/js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="__INDEX__/js/header.js"></script>
	{volist name="js" id="jsName"}
	<script type="text/javascript" src="__INDEX__/js/{$jsName}.js"></script>
	{/volist}
	</head>
<body>
	<!-- 顶部导航 start -->
	<div class="topnav">
		<div class="topnav_bd w1210 bc">
			<div class="topnav_left">
				
			</div>
			<div class="topnav_right fr">
				<ul>
					<li id="logInfo">
						
					</li>
					<li class="line">|</li>
					<li><a href='{:url("Member/order")}'>我的订单</a></li>
					<li class="line">|</li>
					<li>客户服务</li>
				</ul>
			</div>
		</div>
	</div>
	<!-- 顶部导航 end -->
	<div style="clear:both;"></div>

	<!-- 主体内容开始 -->
	{__CONTENT__}
	<!-- 主体内容结束 -->

	<div style="clear:both;"></div>
	<!-- 底部版权 start -->
	<div class="footer w1210 bc mt10">
		<p class="links">
			<a href="javascript:;">关于我们</a> |
			<a href="javascript:;">联系我们</a> |
			<a href="javascript:;">人才招聘</a> |
			<a href="javascript:;">商家入驻</a> |
			<a href="javascript:;">千寻网</a> |
			<a href="javascript:;">奢侈品网</a> |
			<a href="javascript:;">广告服务</a> |
			<a href="javascript:;">移动终端</a> |
			<a href="javascript:;">友情链接</a> |
			<a href="javascript:;">销售联盟</a> |
			<a href="javascript:;">京西论坛</a>
		</p>
		<p class="copyright">
			 © 2005-2013 京东网上商城 版权所有，并保留所有权利。  ICP备案证书号:京ICP证070359号 
		</p>
		<p class="auth">
			<a href="javascript:;"><img src="__INDEX__/images/xin.png" alt="" /></a>
			<a href="javascript:;"><img src="__INDEX__/images/kexin.jpg" alt="" /></a>
			<a href="javascript:;"><img src="__INDEX__/images/police.jpg" alt="" /></a>
			<a href="javascript:;"><img src="__INDEX__/images/beian.gif" alt="" /></a>
		</p>
	</div>
	<!-- 底部版权 end -->
</body>
</html>
<script>

	// AJAX判断登录状态
	var url = "{:url('Common/checkLogin')}";
	$.get(url, function(data) {

		if( data.status ){
			
			var html = "您好，"+data.nickname+" <a href='"+data.logout+"'>[退出]</a>";

			// 商品页评论登录按钮显示与隐藏
			$('#comment_real_form').show();
			$('#login_show').hide();

		}else{
			
			var html = "<div id='logInfo-login'>您好，欢迎来到京西！[<a href='javascript:;'>登录</a>] [<a href='javascript:;'>免费注册</a>]</div> ";

			// 商品页评论登录按钮显示与隐藏
			$('#login_show').show();
			$('#comment_real_form').hide();

		}

		$("#logInfo").html(html);

	},'json');
	
	// 点击登录按钮，将当前页面url存储到session中，并跳转
	
	$("#logInfo-login").find('a').live('click',function() {
	
		var loginRedirectUrl = "{:url('common/loginRedirect','',false)}";
		var returnUrl = "{:request()->pathinfo()}";
		var ctrl = "{:request()->controller()}";
		var act = "{:request()->action()}";
		var index = $(this).index();

		// 如果在登录页面或注册页面点击登录和注册按钮，就直接跳转，不走ajax
		if( ctrl == 'Member' ) {

			if( act == 'loginshow' ) {

				if( index == 0 ){

					return false;

				}else if( index == 1 ){

					location.href="{:url('Member/registShow')}";
					return false;
				}

			}else if( act == 'registshow' ) {

				if( index == 0 ){

					location.href="{:url('Member/loginShow')}";
					return false;

				}else if( index == 1 ){

					return false;
				}
			} 

		}

		//
		if( act == 'deletecache' ){

			returnUrl = http+"/"+goodUrl+"/"+id+".html";

		}
		
		// ajax异步将当前页面url存储到session中，并跳转
		$.get(loginRedirectUrl, {returnUrl:returnUrl,act:act}, function(data) {

			if( index == 0 ){

				location.href="{:url('Member/loginShow')}";

			}else if( index == 1 ){

				location.href="{:url('Member/registShow')}";

			}
			
			
		});

	});
</script>